import QtQuick 2.0

WeaponBase {
    id: flySword
    width: name.width
    height: name.height

    property real gAngle: 0

    function setAngle(angle)
    {
        // 旋转90
        gAngle = angle + 180
    }

    Component.onCompleted: {
    }

    function update()
    {
        // 飞行
        var radian = gAngle / 180 * Math.PI
        flySword.x += Math.cos(radian) * moveSpeed
        flySword.y += Math.sin(radian) * moveSpeed
    }

    Image {
        id: name
        source: "qrc:/images/sword.png"
        transform: Rotation{
            angle: gAngle
            origin.x : 0
            origin.y : name.height/2
        }
    }
}
